//
//  STDatabaseManager.h
//  STBasicsApp
//  数据库
//  Created by jerry on 2019/5/2.
//  Copyright © 2019 jerry. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface STDatabaseManager : NSObject

+ (instancetype)sharedDatabaseManager;

- (LKDBHelper *)getLKDBHelper;

#pragma mark - 表操作部分
///创建表
- (BOOL)createTableWithModelClass:(Class)modelClass;
///删除表
- (void)dropAllTable;
- (BOOL)dropTableWithClass:(Class)modelClass;
- (BOOL)dropTableWithTableName:(NSString *)tableName;

#pragma mark - 数据操作部分
///插入数据
- (BOOL)insertToDB:(NSObject *)model;
- (void)insertToDB:(NSObject *)model callback:(void (^)(BOOL result))block;
- (BOOL)insertWhenNotExists:(NSObject *)model;
- (void)insertWhenNotExists:(NSObject *)model callback:(void (^)(BOOL result))block;

///修改数据
- (BOOL)updateToDB:(NSObject *)model where:(id)where;
- (void)updateToDB:(NSObject *)model where:(id)where callback:(void (^)(BOOL result))block;

///删除数据
- (BOOL)deleteToDB:(NSObject *)model;
- (void)deleteToDB:(NSObject *)model callback:(void (^)(BOOL result))block;

///查询数据
- (NSMutableArray *)queryAllDatas:(Class)modelClass;


@end

NS_ASSUME_NONNULL_END
